<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>绝对定位元素的布局</title>
    <style>
        .box0 {
            width: 600px;
            height: 600px;
            background-color: yellow;
            /*display: block;*/
            /*position: relative;*/
        }
        .box1 {
            width: 500px;
            height: 500px;
            background-color: #bfa;
            /*position: absolute;*/
        }

        .box2 {
            width: 100px;
            height: 100px;
            background-color: orange;

            /*方式一：相对定位*/
            /*position: relative;*/
            /*margin-left: auto;*/
            /*margin-right: auto;*/

        /*    方式二：绝对定位*/
            position: absolute;
            margin-right: auto;
            margin-left: auto;
            left: 0;
            right: 0;
        }
    </style>
</head>
<body>
    <div class="box0">
        <div class="box1">
            <div class="box2"></div>
        </div>
    </div>
</body>
</html>